/*
 * enums
 */

#include <iostream>

// Prefer class enums over “plain” enums to minimize surprises
enum class Color { red, blue, green };
enum class Traffic_light { green, yellow, red };

int main() {
    auto col = Color::red;
    auto light = Traffic_light::red;
    std::cout << (col == Color::red) << std::endl;
    // std::cout << (light == Color::red) << std::endl;    #!Error @Compiling!#
    std::cout << (light == Traffic_light::red) << std::endl;
    return 1;
}

/*
 * `enum` class has only assignment, initialization, and comparisons.(By
Default)
 * one example use the `enum` with user-defined Operator.
Traffic_light& operator++(Traffic_light& t)         // prefix increment: ++
{
     switch (t) {
     case Traffic_light::green:     return t=Traffic_light::yellow;
     case Traffic_light::yellow:    return t=Traffic_light::red;
     case Traffic_light::red:       return t=Traffic_light::green;
     }
}

Traffic_light next = ++light;       // next becomes Traffic_light::green
*/
